﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;

namespace YouHP.Pages
{
    public class Logout:BasePage

    {

        protected UserInfo user = null;

        protected override void ShowPage()
        {
            base.ShowPage();
            PageTitle = "用户退出";
            user = UserBLL.Instance.GetUserInfo(UserData.Id);

            if (user.Id > 0)
            {
                CookiesTools.ClearUserCookie();
                //CookiesTools.WriteUserNameCookie(user.UserName);    //将本次登陆的用户名写入cookie，方便下次用户的输入
            }
            UserData.Id = -1; //退出
            
            SetUrl("Index.aspx");
            SetMetaRefresh();

            AddMsgLine("退出成功，将自动返回首页！");
        }
    }
}
